package dd.control;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

import dd.model.Model;

import xml.Message;

public class ConnectController {
	/**
	 * Once we connected we need to record the id as client id<br>
	 * This Client ID is used when server want to broadcast the client user, a message will directly find this user by
	 * using this id
	 */
	public void process(Message response) {
		// get the client id
		Node update = response.contents.getFirstChild();
		NamedNodeMap map = update.getAttributes();
		String clientId = map.getNamedItem("id").getNodeValue();
		System.out.println("ConnectController process(): Current Client ID is: " + clientId);
		Model.getInstance().getEvent().setclientid(clientId);
	}
}
